package com.zzptc.zzsgz;

import java.util.ArrayList;
import java.util.List;
import java.util.function.Consumer;

public class TestPerson {

    public static void main(String[] args) {
        List<Person> javaProgrammers = new ArrayList<Person>() {
            {
                add(new Person("Elsdon", "Jaycob", "Java programmer", "male", 43, 2000));
                add(new Person("Tamsen", "Brittany", "Java programmer", "female", 23, 1500));
                add(new Person("Floyd", "Donny", "Java programmer", "male", 33, 1800));
                add(new Person("Sindy", "Jonie", "Java programmer", "female", 32, 1600));
                add(new Person("Vere", "Hervey", "Java programmer", "male", 22, 1200));
                add(new Person("Maude", "Jaimie", "Java programmer", "female", 27, 1900));
                add(new Person("Shawn", "Randall", "Java programmer", "male", 30, 2300));
                add(new Person("Jayden", "Corrina", "Java programmer", "female", 35, 1700));
                add(new Person("Palmer", "Dene", "Java programmer", "male", 33, 2000));
                add(new Person("Addison", "Pam", "Java programmer", "female", 34, 1300));
            }
        };

        List<Person> phpProgrammers = new ArrayList<Person>() {
            {
                add(new Person("Jarrod", "Pace", "PHP programmer", "male", 34, 1550));
                add(new Person("Clarette", "Cicely", "PHP programmer", "female", 23, 1200));
                add(new Person("Victor", "Channing", "PHP programmer", "male", 32, 1600));
                add(new Person("Tori", "Sheryl", "PHP programmer", "female", 21, 1000));
                add(new Person("Osborne", "Shad", "PHP programmer", "male", 32, 1100));
                add(new Person("Rosalind", "Layla", "PHP programmer", "female", 25, 1300));
                add(new Person("Fraser", "Hewie", "PHP programmer", "male", 36, 1100));
                add(new Person("Quinn", "Tamara", "PHP programmer", "female", 21, 1000));
                add(new Person("Alvin", "Lance", "PHP programmer", "male", 38, 1600));
                add(new Person("Evonne", "Shari", "PHP programmer", "female", 40, 1800));
            }
        };

        for(Person p1:javaProgrammers){
           // p1.setSalary(p1.getSalary()+1000);
            System.out.print(p1.getSalary()+"\t");
        }
        System.out.println();
        phpProgrammers.forEach(q-> System.out.print(q.getSalary()+"\t"));
        System.out.println();
         //加工资规则
            Consumer<Person> consumer1=o->o.setSalary(o.getSalary()+1000);
        //给JAVA工程师加工资
        javaProgrammers.forEach(consumer1);
        //给PHP工程师加工资
        phpProgrammers.forEach(consumer1);
        //用lambda表达式循环输出
        System.out.println();
        javaProgrammers.forEach(x-> System.out.print(x.getSalary()+"\t"));
        System.out.println();
        phpProgrammers.forEach(y-> System.out.print(y.getSalary()+"\t"));














    }
}
